<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:c="http://xmlns.jcp.org/jsf/composite"
	xmlns:p="http://primefaces.org/ui">

<ui:decorate template="/jsp/WEB/pageLayout.xhtml">

	<ui:define name="centro">
		<h:form id="form">
			<p:growl id="msgs" showDetail="true" />

			<p:panel id="Localizar" header="Localizar Tarifa" toggleable="true"
				toggleSpeed="500" collapsed="true" widgetVar="panel"
				style="margin-bottom:20px">
				<h:panelGrid id="gridTarifas" columns="5" style="border:0px">
					<p:selectOneMenu value="#{TariffBean.tpConsulta}">
						<f:selectItem itemLabel="Descrição" itemValue="1" />
						<f:selectItem itemLabel="Código" itemValue="2" />
					</p:selectOneMenu>

					<p:inputText id="nomes" value="#{TariffBean.textoConsulta}" />

					<p:commandButton id="searchButton" image="ui-icon-search"
						update="cadTarifa" ajax="false" title="Consultar Tarifas"
						actionListener="#{TariffBean.consultarTarifa}" />
				</h:panelGrid>
			</p:panel>

			<br />
			<p:panel id="Cadastrar" header="Cadastrar Tarifa" >
				<h:panelGrid id="cadTarifa" columns="2" >
										
					<h:outputText value="Tipo veiculo: "  />
						<p:selectOneMenu value="#{TariffBean.tar.idVeiculo_tipo}" style="width:150px">
							<f:selectItems value="#{TariffBean.listaTipo}" 
							var="lista" itemLabel="#{lista.getType()}"
								itemValue="#{lista.getId()}" />
						</p:selectOneMenu>
										
					<h:outputText value="Estabelecimento: " />
						<p:selectOneMenu value="#{TariffBean.tar.idEstabelecimento}" style="width:150px">
							<f:selectItems value="#{TariffBean.listaEst}" 
							var="lista" itemLabel="#{lista.razaoSocial}"
								itemValue="#{lista.idEstabelecimento}" />
						
						</p:selectOneMenu>					
					
					<h:outputText value="Descrição: " />
					<p:inputText id="decricao" label="Descrição"
						requiredMessage="Preencha o campo descricao"
						value="#{TariffBean.tar.descricaoTarifa}" />
					
					
					<h:outputLabel for="tempo" value="Tempo* : " />
					<p:inputMask id="tempo" label="Tempo" immediate="true"
						requiredMessage="Preencha o campo Tempo"
						value="#{TariffBean.tar.tempo}"  mask="99:99"/>

					<h:outputLabel for="valor" value="Valor* : " />
					<p:inputText id="valor" label="Valor"
						requiredMessage="Preencha o campo Valor"
						value="#{TariffBean.tar.valor}" />

					<br />
				</h:panelGrid>

				<p:separator />

				<p:commandButton id="salvar" value="Salvar" update="form"
					icon="ui-icon-plusthick" actionListener="#{TariffBean.salvar}"
					ajax="false" oncomplete="handleLoginRequest(xhr, status, args)" />
					
				<p:commandButton id="atualizar" value="Atualizar" update="@all"
					icon="ui-icon-disk" ajax="false"
					actionListener="#{TariffBean.atualizar}" />	

				<p:commandButton id="limpar" value="Limpar" update="@form"
					action="#{TariffBean.refresh()}" icon="ui-icon-document"
					resetValues="true" />
			</p:panel>
		</h:form>

	</ui:define>
</ui:decorate>
</html>